{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# /usr/bin/env python3\n",
    "import os\n",
    "import sys\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "infile = './test_result.tsv'\n",
    "labels = []\n",
    "with open(infile) as f:\n",
    "    for line in f.readlines():\n",
    "        line = line.strip()\n",
    "        if line is None or len(line) == 0:\n",
    "            continue\n",
    "        ss = line.split()\n",
    "        arr = np.array(ss)\n",
    "        label = np.argmax(arr)\n",
    "        labels.append(label)\n",
    "#         print(label)\n",
    "labels = np.array(labels)\n",
    "df = pd.read_csv('./data/Test_Data.csv')\n",
    "df['label'] = labels\n",
    "df_result = df[['id','label']]\n",
    "df_result.to_csv('./data/result.csv', index=False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
